<?php

namespace plugin\admin\app\model;

use plugin\admin\app\model\Base;

/**
 * @property integer $id (主键)
 * @property integer $admin_id 管理员ID
 * @property string $operate 管理员操作
 * @property string $ip IP地址
 * @property string $created_time 创建时间
 */
class AdminLog extends Base
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'wa_admin_logs';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';
    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = false;

    public static function addLog($adminId, $remark, $data = '')
    {
        return self::insert([
            'admin_id' => $adminId,
            'operate' => $remark,
            'ip' => request()->getRemoteIp(),
            'data' => $data,
            'created_time' => date('Y-m-d H:i:s')
        ]);
    }
    
}
